package cz.muni.fi.pb138.videoweb2013.backend;

import java.util.List;
import java.util.Map;

/**
 * Class Medium which holds nam and id of category, id, header and values of medium
 * 
 * @author Lenka Kunikova
 * @since 2013-05-05
 */
public class Medium {
    private int id;
    private List<String> header;
    private Map<String,String> item;
    private String cathegoryName;
    private String cathegoryId;
   
    /**
     * Constructor for MediumManager
     * 
     * @param id
     * @param item
     * @param cathegoryName
     * @param cathegoryId
     * @param header 
     */
    public Medium(int id, Map<String,String> item, String cathegoryName, String cathegoryId, List<String> header )
    {
        this.id = id;
        this.item = item;    
        this.cathegoryName = cathegoryName;
        this.cathegoryId = cathegoryId;
        this.header = header;
    }
    /**
     * Constructor of Medium for use
     * 
     * @param item              map of types and names of staff in medium
     * @param cathegoryName     name of category
     * @param cathegoryId       it is categoryName without white signs
     * @param header            list of types of staff in medium
     */
    public Medium(Map<String,String> item, String cathegoryName,String cathegoryId, List<String> header)
    {
        this.id = 0;
        this.item = item;    
        this.cathegoryName = cathegoryName;
        this.cathegoryId = cathegoryId;
        this.header = header;
    }
     public int getId()
     {
         return id;
     }   
     
     public String getCathegoryName()
     {
         return cathegoryName;
     }
     public void setCathegoryName(String cathegoryName)
     {
         this.cathegoryName = cathegoryName;
     }
     
      public String getCathegoryId()
     {
         return cathegoryId;
     }
     public void setCathegoryId(String cathegoryId)
     {
         this.cathegoryId = cathegoryId;
     }
     
     public Map<String,String> getItem()
     {
         return item;
     }
     public void setItem(Map<String,String> item)
     {
         this.item = item;
     }
     
     public List<String> getHeader()
     {
         return header;
     }
     public void setHeader(List<String> header)
     {
         this.header = header;
     }
        
     public boolean equals(Object obj)
    {
        if (!(obj instanceof Medium)) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        Medium other = (Medium) obj;        
        return ((other.getHeader().equals(this.getHeader())) && (other.getCathegoryName().equals(this.cathegoryName)) && (other.getCathegoryId().equals(this.cathegoryId)) && (other.getItem().equals(this.getItem())));
    }
     
     public int hashCode()
     {
         return cathegoryId.hashCode() + cathegoryName.hashCode() + item.hashCode() + header.hashCode();
     }
   
}

